package com.baor.controller;

import com.baor.domain.AloneVo;
import com.baor.domain.DistributionLevelVo;
import com.baor.service.DistributionLevelService;
import com.baor.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/disLevel")
public class DistributionLevelController {

    @Autowired
    private DistributionLevelService distributionLevelService;


    /**
     * 等级分销 列表
     * @param map
     * @return
     */
    @RequestMapping("/list")
    public AjaxResult<?> list(@RequestBody Map<String,Object> map){
        return distributionLevelService.list(map);
    }

    @RequestMapping("/insert")
    public AjaxResult<?> insert(@RequestBody DistributionLevelVo vo){
        return distributionLevelService.insert(vo);
    }

    @RequestMapping("/update")
    public AjaxResult<?> update(@RequestBody DistributionLevelVo vo){
        return distributionLevelService.update(vo);
    }

    @RequestMapping("/delete/{id}")
    public AjaxResult<?> delete(@PathVariable Integer id){
        return distributionLevelService.delete(id);
    }

    @RequestMapping("/info/{id}")
    public AjaxResult<?> info(@PathVariable Integer id){
        return distributionLevelService.info(id);
    }

    @RequestMapping("/alone/insert")
    public AjaxResult<?> aloneInsert(@RequestBody List<AloneVo> list){
        return distributionLevelService.aloneInsert(list);
    }

    @RequestMapping("/alone/info/{goodsId}")
    public AjaxResult<?> aloneInfo(@PathVariable Integer goodsId){
        return distributionLevelService.aloneInfo(goodsId);
    }

    @RequestMapping("/alone/update")
    public AjaxResult<?> aloneUpdate(@RequestBody List<AloneVo> list){
        return distributionLevelService.aloneUpdate(list);
    }




}
